import { login } from '@/http/user'
import { Promise } from 'core-js';
import Vue from 'vue';
export default {
    namespaced: true,
    state: {
        username: localStorage.getItem('houtainame') || '张三',
        token: localStorage.getItem('houtaitoken'),
    },
    getters: {
    },
    mutations: {
    },
    actions: {
        async logins({ commit }, obj) {
            let res = await login(obj)
            console.log(res);
            if (res.meta.status == 200) {
                localStorage.setItem('houtainame', res.data.username)
                localStorage.setItem('houtaitoken', res.data.token)
                return Promise.resolve(res)
            } else {
                return Promise.reject(res)
            }
        }
    },
    modules: {
    }

}